<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>过期查询</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
	<link rel="stylesheet" href="../../css/public.css" media="all">
	<link rel="shortcut icon" href="#"/>
</head>
<body>
<div class="layuimini-container">
	<div class="layuimini-main">


<form class="layui-form">
			<div class="layui-input-inline">
				<label class="layui-form-label" style="width: 100px;">查询还有</label>
				<input type="text" name="title" lay-verify="title" autocomplete="off" class="layui-input" style="width: 50px;">
			</div>
			<div class="layui-inline">个月到期的药瓶</div>

			<div class="layui-inline">
				<label class="layui-form-label" style="width: 100px;">仓库名称:</label>
				<div class="layui-input-inline" style="width: 110px;">
					<select name="modules" lay-verify="required" lay-search="">
						<option value="">所有仓库</option>
						<option value="1">主仓库</option>
						<option value="2">酒库</option>
						<option value="3">饮料库</option>
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label" style="width: 120px;">商品名称/编号</label>
				<input type="text" id="idAname" name="title" lay-verify="title" autocomplete="off" class="layui-input" style="width: 150px;">
			</div>
			<button type="button" class="layui-btn" id="demand">查询</button>
			<div class="layui-form layui-inline" pane="">
				<div class="layui-input-block">
					<input type="checkbox" name="show" lay-skin="primary" title="显示库存为0的药品" lay-filter="aaa">
				</div>
			</div>
</form>
		<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
	</div>
</div>
<script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'table'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table;
        var state;
        form.on('checkbox(aaa)', function(data){
            var check=data.elem.checked; //是否被选中，true或者false
            if(check==true){
                state=1;
            }else{
                state=0;
            }
            table.reload('currentTableId', {
                url:"/searchNunAndName",
				where:{
                    inveDescProState:state
				},
				page: {
                    curr: 1
                }
            }, 'data');
            return false;
        })
        table.render({
            elem: '#currentTableId',
            url: '/searchNunAndName',
			width:1300,
            cols: [[
                {field: 'proId', width: 140, title: '商品编号'},
                {field: 'inveDescName', width: 150, title: '商品名称'},
                {field: 'inveDescUnit', width: 110, title: '单位'},
                {field: 'inveDescSize', width: 125, title: '产品规格'},
                {field: 'inveDescPostil',width:120, title: '产品批号'},
                {field: 'inveDescValidityDate', width: 110, title: '有效期至',
                    templet:"<div>{{layui.util.toDateString(d.inveDescValidityDate, 'yyyy-MM-dd')}}</div> "},
                {field: 'inveDescManufacturer', width: 110, title: '生成厂商'},
                {field: 'inveDescStartDate', width: 110, title: '生产日期',
                    templet:"<div>{{layui.util.toDateString(d.inveDescStartDate, 'yyyy-MM-dd')}}</div> "},
                {field: 'inveDescInventoryNum', width: 135, title: '库存数量'},
                {field: 'inveDescDepot', width: 145, title: '所在仓库'}
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true,
            skin: 'line'
        });
        table.on('row(currentTableFilter)', function(obj){
            obj.tr.addClass('layui-bg-green').siblings().removeClass('layui-bg-green');
        });
        $('#demand').click(function(){
            table.reload('currentTableId',{
                url:'/searchNunAndName',
                where:{
                    proId:$('#idAname').val(),
                    inveDescName:$('#idAname').val()
                },
                page:{curr:1}
            },'data');
        });;
        //监听表格复选框选择
        table.on('checkbox(currentTableFilter)', function (obj) {
            console.log(obj)
        });


    });
</script>

</body>
</html>